package drds.server.net;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public interface ISessionContext extends Closable {

	/**
	 * connected
	 */
	void init() throws IOException;

	/**
	 * 处理数据
	 */
	void handle(byte[] data);

	/**
	 * 写出一块缓存数据
	 */
	void write(ByteBuffer buffer);

	//
	void setIO();

	IO getIO();

	SocketChannel getSocketChannel();

	void setMaxPacketSize(int maxPacketSize);

	void setPacketHeaderSize(int packetHeaderSize);

	void setIdleTimeout(long idleTimeout);

	void setId(long id);

	void setProcessor(SessionContextGroupShareResources processor);

	IReadWrite getReadWrite();

	long getId();

}